<!-- include tpl=header title=会员注册 -->
<script type="text/javascript">
function update_group(gid)
{
	$.phpok.go(get_url('register','','group_id='+gid));
}
function check_register()
{
	if(!$('#is_ok').prop('checked')){
		$.dialog.alert('注册前请先同意本站协议');
		return false;
	}
	$("#register-form").ajaxSubmit({
		'url':get_url('register','save'),
		'type':'post',
		'dataType':'json',
		'success':function(rs){
			if(rs.status){
				var info = rs.info ? rs.info : '会员注册成功';
				$.dialog.alert(info,function(){
					$.phpok.go(get_url('index'));
				},'succeed');
				return false;
			}
			$.dialog.alert(rs.info);
			return false;
		}
	});
	return false;
}
</script>
<form class="am-form am-form-horizontal" method="post" id="register-form" onsubmit="return check_register()">
	<div style="font-size:1.6em;line-height:200%;text-align:center;border-bottom:1px solid #ccc;">会员注册</div>
	<!-- if $grouplist && count($grouplist) > 1 -->
	<div class="am-form-group">
		<label for="group_id" class="am-u-sm-12 am-form-label">会员组</label>
		<div class="am-u-sm-12">
			<select name="group_id" id="group_id" onchange="update_group(this.value)">
			<!-- loop from=$grouplist key=$key value=$value -->
			<option value="{$value.id}"{if $group_id == $value.id} selected{/if}>{$value.title}</option>
			<!-- /loop -->
			</select>
		</div>
	</div>
	<!-- /if -->
	<!-- if $group_rs.register_status && $group_rs.register_status != 1 -->
	<div class="am-form-group">
		<label for="_code" class="am-u-sm-12 am-form-label">验证串：</label>
		<div class="am-u-sm-12">
			<input class="input" type="text" name="_code" id="_code" value="{$code}" readonly />
		</div>
	</div>
	<!-- /if -->
	<div class="am-form-group">
		<label for="user" class="am-u-sm-12 am-form-label">账号：</label>
		<div class="am-u-sm-12">
			<input class="input" type="text" name="user" id="user" value="{$account}" placeholder="设置登录账号，支持中文" />
		</div>
	</div>
	<div class="am-form-group">
		<label for="newpass" class="am-u-sm-12 am-form-label">密码：</label>
		<div class="am-u-sm-12">
			<input class="input" type="password" name="newpass" id="newpass" placeholder="设置密码，要求不少于6位，建议数字 + 字母" />
		</div>
	</div>
	<div class="am-form-group">
		<label for="chkpass" class="am-u-sm-12 am-form-label">确认密码：</label>
		<div class="am-u-sm-12">
			<input class="input" type="password" name="chkpass" id="chkpass" placeholder="再次输入上面的密码" />
		</div>
	</div>
	<div class="am-form-group">
		<label for="email" class="am-u-sm-12 am-form-label">Email：</label>
		<div class="am-u-sm-12">
			<input type="email" name="email" id="email" placeholder="填写电子邮件">
		</div>
	</div>
	<div class="am-form-group">
		<label for="mobile" class="am-u-sm-12 am-form-label">手机号：</label>
		<div class="am-u-sm-12">
			<input type="tel" name="mobile" id="mobile" placeholder="填写要注册的手机号码">
		</div>
	</div>
	<!-- if $is_vcode -->
	<div class="am-form-group">
		<label for="_chkcode" class="am-u-sm-3 am-form-label">验证码：</label>
		<div class="am-u-sm-5">
			<input type="text" name="_chkcode" id="_chkcode" placeholder="填写右边图片上的数字" />
		</div>	
		<div class="am-u-sm-3" style="margin-top:5px;text-align:left;"><img src="" border="0" align="absmiddle" id="vcode" class="hand" /></div>
		<div class="am-u-sm-2"></div>
	</div>
	<script type="text/javascript">
	$(document).ready(function(){
		$("#vcode").phpok_vcode();
		$("#vcode").click(function(){
			$(this).phpok_vcode();
		});
	});
	</script>
	<!-- /if -->
	<div class="am-form-group">
		<label class="am-u-sm-12"><input type="checkbox" id="is_ok" name="is_ok"> 我已阅读并完全同意阅读<a href="javascript:void(0);"data-am-modal="{target: '#my-popup'}">注册协议</a></label>
    </div>
    <div class="am-form-group">
		<div class="am-u-sm-12">
			<button type="submit" class="am-btn am-btn-primary">注册会员</button>
			<a href="{$sys.url}" class="am-btn am-btn-default am-fr">返回首页</a>
		</div>
	</div>
</form>

<div class="am-popup" id="my-popup">
	<div class="am-popup-inner">
		<div class="am-popup-hd">
			<h4 class="am-popup-title">协议说明</h4>
			<span data-am-modal-close class="am-close">&times;</span>
		</div>
		<div class="am-popup-bd">
			<!-- include tpl=block/protocol -->
		</div>
	</div>
</div>
<!-- include tpl=footer -->